<template>
  <span v-on="$listeners" class="yk__icon__wrapper">
    <svg class="yk__icon" aria-hidden="true">
      <use :xlink:href="iconName" />
    </svg>
  </span>
</template>

<script>
export default {
  name: 'svg-icon',
  inheritAttrs: false,
  props: {
    icon: {
      type: String,
      required: true
    }
  },
  computed: {
    iconName () {
      return `#icon-${this.icon}`
    }
  }
}
</script>

<style lang="scss" scoped>
.yk__icon__wrapper {
  display: inline-block;
  line-height: 1;
  .yk__icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    overflow: hidden;
    vertical-align: top;
    fill: currentcolor;
  }
}
</style>
